home *** CD-ROM | disk | FTP | other *** search
/ Visual Cafe 3 / Visual Cafe 3.ISO / Vcafe / Main.bin / MaskedTextFieldBeanInfo.java < prev    next >
Text File  |  1998-10-28  |  4KB  |  101 lines

  1. /*
  2.  * @(#MaskedTextFieldBeanInfo.java
  3.  *
  4.  * Copyright (c) 1998 Symantec Corporation. All Rights Reserved.
  5.  *
  6.  */
  7.  
  8. package com.symantec.itools.awt;
  9.  
  10. import java.beans.*;
  11. import java.util.ResourceBundle;
  12. import com.symantec.itools.beans.HelperBeanInfo;
  13. import com.symantec.itools.vcafe.beans.ActionDescriptor;
  14. import com.symantec.itools.vcafe.beans.MethodDescriptorAttributes;
  15.  
  16. //  08/19/98    LAB    Moved to GroupAWTAdditions folder.
  17.  
  18. /**
  19.  * BeanInfo for the MaskedTextField component.
  20.  *
  21.  */
  22. public class MaskedTextFieldBeanInfo extends HelperBeanInfo {
  23.     protected final static String m_WinHelpID = "0x123AE";
  24.     
  25.     public MaskedTextFieldBeanInfo() {
  26.         setInheritSuperBeanInfo(true);
  27.         
  28.         ResourceBundle group = ResourceBundle.getBundle("com.symantec.itools.awt.GroupBundle");
  29.         String s = group.getString("GroupAWTAdditions");
  30.         
  31.         setComponentLibraryFolder(s);
  32.         setToolbarFolder(s);        
  33.         //setWinHelpKey(m_WinHelpID);    
  34.         
  35.         // set icons
  36.         set16x16ColorIconName("mask16.gif");
  37.         set32x32ColorIconName("mask32.gif");
  38.         set16x16MonoIconName("mask16bw.gif");
  39.         set32x32MonoIconName("mask32bw.gif");
  40.     }
  41.  
  42.     public PropertyDescriptor[] getPropertyDescriptors() {
  43.         ResourceBundle prop = ResourceBundle.getBundle("com.symantec.itools.awt.PropBundle");
  44.         try {
  45.             PropertyDescriptor mask = new PropertyDescriptor("mask", beanClass);
  46.             mask.setDisplayName(prop.getString("mask"));
  47.  
  48.             PropertyDescriptor[] rv = {    mask };
  49.             return rv;
  50.         } catch (IntrospectionException e) { throw new Error(e.toString()); }
  51.     }
  52.  
  53.     /**
  54.      * Gets an array of descriptions of the methods used for "connections" by
  55.      * Visual CafΘ's Interaction Wizard.
  56.      * Included in each method description is a CONNECTIONS ActionDescriptor.
  57.      * @return method descriptions for this bean
  58.      * @see com.symantec.itools.vcafe.beans.ActionDescriptor
  59.      */
  60.     public MethodDescriptor[] getMethodDescriptors() {
  61.         Class[] args = null;
  62.         ActionDescriptor connection;
  63.         java.util.Vector connections;
  64.         java.util.Vector md = new java.util.Vector();
  65.         ResourceBundle conn = ResourceBundle.getBundle("com.symantec.itools.awt.ConnBundle");
  66.         String s;
  67.         try {
  68.             MethodDescriptor getMask = new MethodDescriptor(beanClass.getMethod("getMask", args));
  69.             connections = new java.util.Vector();
  70.             connection = new ActionDescriptor("output", "String", "",
  71.                                                   "%name%.getMask()",
  72.                                                   conn.getString("getMask"));
  73.             connections.addElement(connection);
  74.             getMask.setValue(MethodDescriptorAttributes.ACTION_ATTRIBUTE, connections);
  75.             md.addElement(getMask);
  76.         } catch (Exception e) { throw new Error("getMask:: " + e.toString()); }
  77.         try{
  78.             args = new Class[1];
  79.             args[0] = java.lang.String.class ;
  80.             MethodDescriptor setMask = new MethodDescriptor(beanClass.getMethod("setMask", args));
  81.             connections = new java.util.Vector();
  82.             connection = new ActionDescriptor("input", "String", "",
  83.                                                   "%name%.setMask(%arg%);",
  84.                                                   conn.getString("setMask"));
  85.             connections.addElement(connection);
  86.             setMask.setValue(MethodDescriptorAttributes.ACTION_ATTRIBUTE, connections);
  87.             md.addElement(setMask);
  88.         } catch (Exception e) { throw new Error("setMask:: " + e.toString()); }
  89.         MethodDescriptor[] rv = new MethodDescriptor[md.size()];
  90.         md.copyInto(rv);
  91.         return rv;
  92.     }
  93.  
  94.     protected Class getBeanClass()
  95.     {
  96.         return beanClass;
  97.     }
  98.  
  99.     private final static Class beanClass = MaskedTextField.class;
  100. }
  101.